package com.haoxi.gateway.cmppmsg;

import com.haoxi.gateway.util.TypeConvert;

public class CMPPTerminateMessage extends CMPPMessage {

    public CMPPTerminateMessage() {
        int len = 12;
        buf = new byte[len];
        TypeConvert.int2byte(len, buf, 0);
        TypeConvert.int2byte(CMPPCommon.CMPP_TERMINATE, buf, 4);
    }

    public CMPPTerminateMessage(byte buf[]) throws IllegalArgumentException {
        super.buf = new byte[4];
        if (buf.length != 4) {
            throw new IllegalArgumentException(
                    "The message that is sent by SMC is wrong");
        } else {
            System.arraycopy(buf, 0, super.buf, 0, 4);
            sequence_Id = TypeConvert.byte2int(super.buf, 0);
        }
    }

    public String toString() {
        StringBuffer tmpBuf = new StringBuffer("CMPP_Terminate: ");
        tmpBuf.append("Sequence_Id=").append(getSequenceId());
        return tmpBuf.toString();
    }

    public int getCommandId() {
        return CMPPCommon.CMPP_TERMINATE;
    }
}
